package com.iias;

import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import com.iias.data.pool.DataPool;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import javax.sql.DataSource;

@Configuration
@Component
public class TaskRunConfig {



    @Bean("taskDataSource")
    @ConfigurationProperties(prefix = "spring.datasource.druid" )
    public DataSource getDataSource(){
        DruidDataSource build = DruidDataSourceBuilder.create().build();
        DataPool.setDataSource(build);
        return build;
    }

}
